package date;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class LocalDateDemo {
	public static void main(String[] args) {
		//local本地
		LocalDate date = LocalDate.now();
		System.out.println(date);   //2022-04-27
		
		LocalTime time = LocalTime.now();
		System.out.println(time);   //16:22:56.649
		
		LocalDateTime dateTime = LocalDateTime.now();
		System.out.println(dateTime);  //2022-04-27T16:23:26.662
		
		System.out.println(date.getYear());
		System.out.println(date.getMonthValue());  //1月就是1
		System.out.println(date.getDayOfMonth());
		System.out.println(time.getHour());
		System.out.println(time.getMinute());
		System.out.println(time.getSecond());
		
		// of设置一个时间对象，不能new
		LocalDate date2 = LocalDate.of(5000, 1, 1);
		LocalTime time2 = LocalTime.of(13, 13, 13);
		LocalDateTime dateTime2 = LocalDateTime.of(6000, 2, 2, 13, 53,55);
	}
}
